package com.yupi.oj.ojMQ;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class OjMessageProducer {
    @Resource
    private RabbitTemplate rabbitTemplate;

    //绑定自定义命名的交换机名称和路由关键字
    public void sendMessage(String message){
        rabbitTemplate.convertAndSend(Ojconstant.EXCHANGE_NAME,Ojconstant.ROUTING_KEY ,message);
    }
}
